# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-sony-amami
pkgver=4
pkgrel=6
pkgdesc="Sony Xperia Z1 Compact"
url="https://postmarketos.org"
arch="armv7"
license="MIT"
depends="
	mdss-fb-init-hack
	mkbootimg
	postmarketos-base
	soc-qcom-msm8974
"
makedepends="devicepkg-dev"
subpackages="
	$pkgname-kernel-downstream:kernel_downstream
	$pkgname-kernel-mainline:kernel_mainline
	$pkgname-nonfree-firmware:nonfree_firmware
"
source="deviceinfo modules-initfs.mainline 90-android-touch-dev.rules fb.modes"
options="!check !archcheck"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
	install -D -m644 "$srcdir"/90-android-touch-dev.rules \
		"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
	install -D -m644 "$srcdir"/fb.modes \
		"$pkgdir"/etc/fb.modes
}

kernel_downstream() {
	pkgdesc="Display and wifi works (see device table for details)"
	depends="linux-sony-amami"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_mainline() {
	pkgdesc="Close to mainline; for kernel development only (most features aren't working)"
	depends="linux-postmarketos-qcom-msm8974"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

nonfree_firmware() {
	pkgdesc="Wifi firmware"
	depends="firmware-sony-rhine"
	mkdir "$subpkgdir"
}

sha512sums="
d99d2f42de98bfde368824bbd0360690505936a2517e06111a7006af0b761bbef98bfcb83c1f849441bb99de627e6333254eb2942079f210c3cd5c4aedfdcb53  deviceinfo
760cc0e57426a534412c113addf8406c43463b3153a8517cc5d97eb9eec57d1e3a4af7f36dfcb1b5ed1d2b0be7d57af7903b5209096a902949f05df79b96dd66  modules-initfs.mainline
8b6034c0338ab4c7d648f47983aad6da07e427e7dba47baabf85a1b3ddeeda47c8d7fbcd547a302c9a759b2943ee30d3e82c3b368d8582833a058e4671638a9e  90-android-touch-dev.rules
4dc5b6a2d9de6b97e4033b14771b8a6afe922afcd0bc4c97481cfad775726109dd0570058b94b2cd805691343076e7d4d886218787ba883cc31dd1e6e3abb0af  fb.modes
"
